package com.ims.core.doc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ims.common.annotation.Log;
import com.ims.common.core.controller.BaseController;
import com.ims.common.core.domain.AjaxResult;
import com.ims.common.enums.BusinessType;
import com.ims.core.doc.domain.TInAccountingQueryNonInvoice;
import com.ims.core.doc.service.ITInAccountingQueryNonInvoiceService;
import com.ims.common.utils.poi.ExcelUtil;
import com.ims.common.core.page.TableDataInfo;

/**
 * 非增值税发票报账单查询Controller
 *
 * @author IMS
 * @date 2024-12-03
 */
@RestController
@RequestMapping("/doc/inaccountingquerynoninvoice")
public class TInAccountingQueryNonInvoiceController extends BaseController
{
    @Autowired
    private ITInAccountingQueryNonInvoiceService tInAccountingQueryNonInvoiceService;

    /**
     * 查询非增值税发票报账单查询列表
     */
    @PreAuthorize("@ss.hasPermi('doc:inaccountingquerynoninvoice:list')")
    @GetMapping("/list")
    public TableDataInfo list(TInAccountingQueryNonInvoice tInAccountingQueryNonInvoice)
    {
        startPage();
        List<TInAccountingQueryNonInvoice> list = tInAccountingQueryNonInvoiceService.selectTInAccountingQueryNonInvoiceList(tInAccountingQueryNonInvoice);
        return getDataTable(list);
    }

    /**
     * 导出非增值税发票报账单查询列表
     */
    @PreAuthorize("@ss.hasPermi('doc:inaccountingquerynoninvoice:export')")
    @Log(title = "非增值税发票报账单查询", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TInAccountingQueryNonInvoice tInAccountingQueryNonInvoice)
    {
        List<TInAccountingQueryNonInvoice> list = tInAccountingQueryNonInvoiceService.selectTInAccountingQueryNonInvoiceList(tInAccountingQueryNonInvoice);
        ExcelUtil<TInAccountingQueryNonInvoice> util = new ExcelUtil<TInAccountingQueryNonInvoice>(TInAccountingQueryNonInvoice.class);
        util.exportExcel(response, list, "非增值税发票报账单查询数据");
    }

    /**
     * 获取非增值税发票报账单查询详细信息
     */
    @PreAuthorize("@ss.hasPermi('doc:inaccountingquerynoninvoice:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tInAccountingQueryNonInvoiceService.selectTInAccountingQueryNonInvoiceById(id));
    }

    /**
     * 新增非增值税发票报账单查询
     */
    @PreAuthorize("@ss.hasPermi('doc:inaccountingquerynoninvoice:add')")
    @Log(title = "非增值税发票报账单查询", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TInAccountingQueryNonInvoice tInAccountingQueryNonInvoice)
    {
        return toAjax(tInAccountingQueryNonInvoiceService.insertTInAccountingQueryNonInvoice(tInAccountingQueryNonInvoice));
    }

    /**
     * 修改非增值税发票报账单查询
     */
    @PreAuthorize("@ss.hasPermi('doc:inaccountingquerynoninvoice:edit')")
    @Log(title = "非增值税发票报账单查询", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TInAccountingQueryNonInvoice tInAccountingQueryNonInvoice)
    {
        return toAjax(tInAccountingQueryNonInvoiceService.updateTInAccountingQueryNonInvoice(tInAccountingQueryNonInvoice));
    }

    /**
     * 删除非增值税发票报账单查询
     */
    @PreAuthorize("@ss.hasPermi('doc:inaccountingquerynoninvoice:remove')")
    @Log(title = "非增值税发票报账单查询", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tInAccountingQueryNonInvoiceService.deleteTInAccountingQueryNonInvoiceByIds(ids));
    }
}
